package org.keyyond.ms.scheduler.service.impl;

import org.keyyond.ms.core.util.HttpUtil;
import org.keyyond.ms.scheduler.service.SapZzJobService;
import org.keyyond.ms.scheduler.util.EncryptUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class SapZzJobServiceImpl implements SapZzJobService{
    
    private static Logger logger = LoggerFactory.getLogger(SapZzJobServiceImpl.class);
    
    @Value("${authParam}")
    private String authParam;
    
    @Value("${sendSapZzJobServiceUrl}")
    private String sendSapZzJobServiceUrl;

    @Override
    public String doSendZzToSap() {
	String encrypt = EncryptUtil.encrypt(authParam);
	String result = null;
	if (encrypt != null) {
	    logger.info("总账凭证推送开始！");
	    result = HttpUtil.sendPost(sendSapZzJobServiceUrl + encrypt, "{}", "UTF-8");
	} else {
	    logger.info("没有权限！");
	}

	return result;
    }

}
